import 'dart:ffi';
import 'dart:ui';
import 'package:flutter_html/flutter_html.dart';
import 'package:magic_car/authinspcter/submitauthcarinfo.dart';
import 'package:magic_car/common/nodata.dart';
import 'package:magic_car/util/colors.dart';
import 'package:magic_car/util/config.dart';
import 'package:flutter/material.dart';
import 'package:magic_car/util/HttpHelper.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:toast/toast.dart';
import 'package:flutter/services.dart';
import 'package:fluwx/fluwx.dart' as fluwx;

class ChargerGroupPage extends StatefulWidget {
  ChargerGroupPage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<ChargerGroupPage> {
  Map acountinfo;

  String balance = "0.00";
  String chargemoney = "";
  String total_num = "0";
  String pre_value = "0";
  bool ischargergroup = false;
  String total_num_des = "0台";
  String groupid = "";
  String level_name = "无";
  String selectlevel = "";

  List moneylist = [];
  @override
  void initState() {
    super.initState();
    fluwx.weChatResponseEventHandler.listen((res) {
      print(res);
      if (res is fluwx.WeChatPaymentResponse) {
        if (res.isSuccessful) {
          //支付成功
          Toast.show('充值成功', context);
          loaddata();
        }
      }
    });
    loaddata(); //页面展示时加载数据
    loadchargergroupdata();
  }

  //加载套餐数据
  loadchargergroupdata() async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["id"] = pref.getString('uid');

    print(map);

    HttpHelper.post(HttpHelper.API_Bussinessgroup, (data) async {
      if (data != null) {
        print(data);

        if (data["code"].toString() == "1") {
          setState(() {
            moneylist = data["info"];
            // balance = data["info"]["balance"];
          });
        }
      }
    }, params: map);
  }

  //加载数据
  loaddata() async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["id"] = pref.getString('uid');

    print(map);

    HttpHelper.post(HttpHelper.API_BusinessInfo, (data) async {
      if (data != null) {
        print(data);
        print(data["info"].length.toString());
        if (data["code"].toString() == "1") {
          setState(() {
            acountinfo = data["info"];
            // balance = data["info"]["balance"];
          });
          if (acountinfo["is_chargergroup"].toString() == "1") {
            setState(() {
              ischargergroup = true;
              level_name = acountinfo['groupdata']['level_name'];
            });
            total_num_des = (int.parse(acountinfo["groupdata"]['total_num']) -
                        int.parse(acountinfo["groupdata"]['used_num']))
                    .toString() +
                "台";
          }
        }
      }
    }, params: map);
  }

  pay() async {
    if (chargemoney == "") {
      Toast.show("请选择充值套餐", context);
      return;
    }
    Map<String, String> param = new Map();
    param['money'] = chargemoney;
    SharedPreferences pref = await SharedPreferences.getInstance();
    param["uid"] = pref.getString('uid');
    param["ctype"] = "1";
    param["total_num"] = total_num;
    param["pre_value"] = pre_value;
    param['group_id'] = groupid;
    param['level_name'] = selectlevel;
    HttpHelper.post(HttpHelper.API_Dobussinesscharger, (data) async {
      //loadpage.close();
      //loadpage.close();
      if (data != null) {
        if (data["code"].toString() == "1") {
          var payinfo = data['info'];
          print(payinfo['prepayid']['0']);
          fluwx.payWithWeChat(
              appId: Config.wx_appid,
              partnerId: payinfo['partnerid'],
              prepayId: payinfo['prepayid']['0'],
              packageValue: payinfo['package'],
              nonceStr: payinfo['noncestr'],
              timeStamp: int.parse(payinfo['timestamp']),
              sign: payinfo['sign']);
        } else {
          Toast.show(data['msg'], context);
        }
      }
    }, params: param);
  }

  showalert() {
    showModalBottomSheet(
        context: context,
        builder: (BuildContext context) {
          return Container(
            child: Padding(
                padding: new EdgeInsets.fromLTRB(0, 0, 0, 0),
                child: Container(
                  height: 120,
                  child: new Column(children: <Widget>[
                    // new Container(
                    //     decoration: new BoxDecoration(
                    //         border: Border(
                    //             bottom:
                    //                 BorderSide(width: 1, color: Color(0xffe5e5e5)))),
                    //     height: 50,
                    //     child: Center(
                    //         child: Text('上传图片', style: TextStyle(fontSize: 16)))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.of(context)
                                  .push(new MaterialPageRoute(builder: (_) {
                                return new BusinessAuthStartPage(2, "0", "0");
                                // return new StartPicPage(this.oid, order_info['test_type']);
                              })).then((param) {
                                //loadOrderInfo();
                              });
                              //  Navigator.pushNamed(context, "addauthcarinfo");
                            },
                            child: Center(
                                child: Text('新建车源',
                                    style: TextStyle(
                                        fontSize: 16, color: Colors.black))))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.pushNamed(context, "mycar");
                              // Navigator.pushNamed(
                              //     context, "imdatesubmitcarinfo");
                            },
                            child: Center(
                                child: Text('已有车源',
                                    style: TextStyle(fontSize: 16))))),
                    new Container(
                        decoration: new BoxDecoration(
                            border: Border(
                                bottom: BorderSide(
                                    width: 1, color: Color(0xffe5e5e5)))),
                        height: 40,
                        child: new GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () async {
                              Navigator.pop(context);
                              Navigator.pushNamed(
                                  context, "imdatesubmitcarinfo");
                              //  submit();
                            },
                            child: Center(
                                child: Text('快速下单',
                                    style: TextStyle(
                                        fontSize: 16, color: Colors.red))))),
                  ]),
                )),
          );
        });
  }

  //提交认证检测订单
  submit() async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["uid"] = pref.getString('uid');
    map["num"] = "20";

    print(map);

    HttpHelper.post(HttpHelper.API_Create_auth_Order, (data) async {
      if (data != null) {
        Toast.show(data["msg"], context, duration: 2);
      }
    }, params: map);
  }

  precheckgroup() async {
    SharedPreferences pref = await SharedPreferences.getInstance();
    Map<String, String> map = new Map();
    map["uid"] = pref.getString('uid');

    HttpHelper.post(HttpHelper.API_PrecheckGroup, (data) async {
      //loadpage.close();
      if (data != null) {
        print(data);
        //Toast.show(data["msg"], context);

        if (data["code"].toString() == "1") {
          showalert();
        } else {
          Toast.show(data["msg"], context);
        }
      }
    }, params: map);
  }

  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          titleSpacing: 0,
          title: new Text(
            '充值套餐',
            style: TextStyle(fontSize: Config.title_size),
          ),
          backgroundColor: Colors.white,
          elevation: 0,
        ),
        body: acountinfo == null
            ? Nodata()
            : new Container(
                color: Colours.base_page_color,
                child: new ListView(
                  children: <Widget>[
                    new Padding(
                      padding: new EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 15.0),
                      child: new Column(
                        children: <Widget>[
                          new Container(
                              color: Colors.white,
                              child: new Column(children: <Widget>[
                                new Padding(
                                  padding: new EdgeInsets.fromLTRB(
                                      0.0, 10.0, 0.0, 10.0),
                                  child: new Center(
                                    child: new Text(
                                      '可用套餐',
                                      style: TextStyle(fontSize: 15),
                                    ),
                                  ),
                                ),
                                new Padding(
                                  padding: new EdgeInsets.fromLTRB(
                                      0.0, 0.0, 0.0, 20.0),
                                  child: new Center(
                                    child: new Text(
                                      level_name,
                                      style: TextStyle(
                                          fontSize: 20,
                                          color: Colours.bj_orange_o2,
                                          fontWeight: FontWeight.w700),
                                    ),
                                  ),
                                ),
                                // Offstage(
                                //   offstage: true,
                                //   child:
                                ischargergroup == false
                                    ? Container(
                                        height: 0,
                                      )
                                    : Container(
                                        margin: EdgeInsets.only(bottom: 10),
                                        child: Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.center,
                                          children: [
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(acountinfo["groupdata"]
                                                        ["money"]
                                                    .toString()),
                                                Container(height: 5),
                                                Text("充值金额")
                                              ],
                                            )),
                                            Container(width: 20),
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(acountinfo["groupdata"]
                                                        ["balance"]
                                                    .toString()),
                                                Container(height: 5),
                                                Text("剩余金额")
                                              ],
                                            )),
                                            Container(width: 20),
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(acountinfo["groupdata"]
                                                        ["pre_value"]
                                                    .toString()),
                                                Container(height: 5),
                                                Text("单台价格")
                                              ],
                                            ))
                                          ],
                                        )),
                                // ),
                                ischargergroup == false
                                    ? Container(
                                        height: 0,
                                      )
                                    : Container(
                                        margin: EdgeInsets.only(bottom: 10),
                                        child: Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.center,
                                          children: [
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(
                                                    "${acountinfo["groupdata"]["query_faultcode_price"]}"),
                                                Container(height: 5),
                                                Text("历史故障")
                                              ],
                                            )),
                                            Container(width: 20),
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(
                                                    "${acountinfo["groupdata"]["query_milage_price"]}"),
                                                Container(height: 5),
                                                Text("历史里程")
                                              ],
                                            )),
                                            Container(width: 20),
                                            Container(
                                                child: Column(
                                              children: [
                                                Text(
                                                    "${acountinfo["groupdata"]["ensurance_back_rate"]}"),
                                                Container(height: 5),
                                                Text("质保返点")
                                              ],
                                            ))
                                          ],
                                        )),
                                new Container(
                                  height: 1,
                                  color: Color.fromRGBO(239, 239, 239, 1),
                                ),
                                // new Padding(
                                //   padding:
                                //       new EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 10.0),
                                //   child: new Center(
                                //     child: new Text(
                                //       '总收益',
                                //       style: TextStyle(fontSize: 15),
                                //     ),
                                //   ),
                                // ),
                                // new Padding(
                                //   padding:
                                //       new EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 30.0),
                                //   child: new Center(
                                //     child: new Text(
                                //       acountinfo.containsKey('total')?acountinfo["total"].toString():"0.00",
                                //       style: TextStyle(fontSize: 24,fontWeight: FontWeight.w400),
                                //     ),
                                //   ),
                                // )
                              ])),
                          Offstage(
                              offstage: false,
                              child: new Padding(
                                  padding: EdgeInsets.fromLTRB(20, 10, 20, 0),
                                  child: Align(
                                    alignment: Alignment.topLeft,
                                    child: Text('立即充值'),
                                  ))),
                          Offstage(
                            child: buildmoney(),
                            offstage: false,
                          ),

                          // false
                          //     ? Container(height: 0)
                          //     :
                          new Padding(
                              padding: new EdgeInsets.fromLTRB(
                                  20.0, 0.0, 20.0, 10.0),
                              child: new Container(
                                width: double.infinity,
                                height: 40,

                                child: new Material(
                                  color: Color.fromRGBO(239, 239, 239, 1),
                                  //INK可以实现装饰容器
                                  child: new Ink(
                                    //用ink圆角矩形
                                    // color: Colors.red,
                                    decoration: new BoxDecoration(
                                      //背景
                                      color: Colours.bj_orange_o2,
                                      //设置四周圆角 角度
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(20.0)),
                                      //设置四周边框
                                      border: new Border.all(
                                          width: 1,
                                          color: Colours.bj_orange_o2),
                                    ),
                                    child: new InkWell(
                                        //圆角设置,给水波纹也设置同样的圆角
                                        //如果这里不设置就会出现矩形的水波纹效果
                                        borderRadius:
                                            new BorderRadius.circular(15.0),

                                        //设置点击事件回调
                                        onTap: () {
                                          FocusScope.of(context)
                                              .requestFocus(FocusNode());
                                          //隐藏键盘
                                          pay();
                                          // if (chargemoney[0] == "0") {
                                          //   Toast.show(
                                          //       '请输入正确的金��', context);
                                          // } else if (double.parse(
                                          //         chargemoney) <
                                          //     1) {
                                          //   Toast.show(
                                          //       '充值金额必须大于1', context);
                                          // } else {
                                          //   pay();
                                          // }
                                          //
                                        },
                                        child: Container(
                                          //设置 child 居中
                                          alignment: Alignment(0, 0),
                                          height: 40,
                                          width: double.infinity,
                                          //color: Color.fromRGBO(27, 182, 251, 1),
                                          child: Text(
                                            "充值",
                                            style:
                                                TextStyle(color: Colors.white),
                                          ),
                                        )),
                                  ),
                                ),
                                // child: new RaisedButton(
                                //   child: new Text(
                                //     '提现',
                                //     style: TextStyle(fontSize: 16),
                                //   ),
                                //   textColor: Colors.white,
                                //   color: Color.fromRGBO(27, 182, 251, 1),
                                //   onPressed: () {},
                                // ),
                              )),
                          // !ischargergroup
                          //     ? Container(height: 0)
                          //     :
                          new Padding(
                              padding: new EdgeInsets.fromLTRB(
                                  20.0, 0.0, 20.0, 10.0),
                              child: new Container(
                                width: double.infinity,
                                height: 40,

                                child: new Material(
                                  color: Color.fromRGBO(239, 239, 239, 1),
                                  //INK可以实现装饰容器
                                  child: new Ink(
                                    //用ink圆角矩形
                                    // color: Colors.red,
                                    decoration: new BoxDecoration(
                                      //背景
                                      color: Color.fromRGBO(27, 182, 251, 1),
                                      //设置四周圆角 角度
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(20.0)),
                                      //设置四周边框
                                      border: new Border.all(
                                          width: 1,
                                          color:
                                              Color.fromRGBO(27, 182, 251, 1)),
                                    ),
                                    child: new InkWell(
                                        //圆角设置,给水波纹也设置同样的圆角
                                        //如果这里不设置就会出现矩形的水波纹效果
                                        borderRadius:
                                            new BorderRadius.circular(15.0),

                                        //设置点击事件回调
                                        onTap: () {
                                          precheckgroup();
                                          //  showalert();
                                        },
                                        child: Container(
                                          //设置 child 居中
                                          alignment: Alignment(0, 0),
                                          height: 40,
                                          width: double.infinity,
                                          //color: Color.fromRGBO(27, 182, 251, 1),
                                          child: Text(
                                            "进行认证检测",
                                            style:
                                                TextStyle(color: Colors.white),
                                          ),
                                        )),
                                  ),
                                ),
                                // child: new RaisedButton(
                                //   child: new Text(
                                //     '提现',
                                //     style: TextStyle(fontSize: 16),
                                //   ),
                                //   textColor: Colors.white,
                                //   color: Color.fromRGBO(27, 182, 251, 1),
                                //   onPressed: () {},
                                // ),
                              )),
                          new Padding(
                              padding: new EdgeInsets.fromLTRB(
                                  20.0, 0.0, 20.0, 10.0),
                              child: new Container(
                                width: double.infinity,
                                height: 40,
                                child: new Material(
                                  color: Color.fromRGBO(239, 239, 239, 1),
                                  //INK可以实现装饰容器
                                  child: new Ink(
                                    //用ink圆角矩形
                                    // color: Colors.red,
                                    decoration: new BoxDecoration(
                                      //背景
                                      color: Colours.bj_orange_o1,
                                      //设置四周圆角 角度
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(20.0)),
                                      //设置四周边框
                                      border: new Border.all(
                                          width: 1, color: Colours.app_main),
                                    ),
                                    child: new InkWell(
                                        //圆角设置,给水波纹也设置同样的圆角
                                        //如果这里不设置就会出现矩形的水波纹效果
                                        borderRadius:
                                            new BorderRadius.circular(15.0),

                                        //设置点击事件回调
                                        onTap: () {
                                          Navigator.pushNamed(
                                              context, "chargergrouprec");
                                          //
                                        },
                                        child: Container(
                                          //设置 child 居中
                                          alignment: Alignment(0, 0),
                                          height: 40,
                                          width: double.infinity,
                                          //color: Color.fromRGBO(27, 182, 251, 1),
                                          child: Text(
                                            "充值记录",
                                            style:
                                                TextStyle(color: Colors.white),
                                          ),
                                        )),
                                  ),
                                ),
                              )),
                          // new Padding(
                          //     padding:
                          //         new EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
                          //     child: new Container(
                          //       width: double.infinity,
                          //       height: 40,
                          //       child: new Material(
                          //         color: Color.fromRGBO(239, 239, 239, 1),
                          //         //INK可以实现装饰容器
                          //         child: new Ink(
                          //           //用ink圆角矩形

                          //           decoration: new BoxDecoration(
                          //             //背景
                          //             color: Colors.white,
                          //             //设置四周圆角 角度
                          //             borderRadius:
                          //                 BorderRadius.all(Radius.circular(20.0)),
                          //             //设置四周边框
                          //             border: new Border.all(
                          //                 width: 1,
                          //                 color: Color.fromRGBO(27, 182, 251, 1)),
                          //           ),
                          //           child: new InkWell(
                          //               //圆角设置,给水波纹也设置同样的圆角
                          //               //如果这里不设置就会出现矩形的水波纹效果
                          //               borderRadius: new BorderRadius.circular(15.0),

                          //               //设置点击事件回调
                          //               onTap: () {
                          //                 //moneydetail
                          //                 Navigator.pushNamed(context, "moneydetail");
                          //               },
                          //               child: Container(
                          //                 //设置 child 居中
                          //                 alignment: Alignment(0, 0),
                          //                 height: 40,
                          //                 width: double.infinity,
                          //                 //color: Color.fromRGBO(27, 182, 251, 1),
                          //                 child: Text(
                          //                   "余额明细",
                          //                   style: TextStyle(
                          //                       color:
                          //                           Color.fromRGBO(27, 182, 251, 1)),
                          //                 ),
                          //               )),
                          //         ),
                          //       ),
                          //       // child: new RaisedButton(
                          //       //   child: new Text(
                          //       //     '账户明细',
                          //       //     style: TextStyle(fontSize: 16),
                          //       //   ),
                          //       //   textColor: Colors.white,
                          //       //   color: Color.fromRGBO(27, 182, 251, 1),
                          //       //   onPressed: () {},
                          //       // ),
                          //     )),
                          // Padding(padding: new EdgeInsets.fromLTRB(20.0, 50.0, 20.0, 10.0),child: new Center(
                          //   child:Text("交易检测收益每月最多可提现三次，单次金额不能低于100元",style: new TextStyle(color: Color.fromRGBO(102, 102, 102, 1),fontSize: 12),)
                          // ),)
                        ],
                      ),
                    ),
                  ],
                ),
              ));
  }

  Widget buildmoney() {
    List<Widget> tiles = [];

    Widget content;

    List items = moneylist;
    print(items);
    // print('图片数组长度'+items.isNotEmpty.toString());
    if (items.length > 0) {
      // tiles.add(new Container(
      //       padding: new EdgeInsets.fromLTRB(60, 0, 20, 0),)
      for (var i = 0; i < items.length; i++) {
        //List temp1 = items[i] as List;
        tiles.add(new Container(
            width: MediaQuery.of(context).size.width / 2 - 30, //等宽设置
            // width: 33%,
            margin: EdgeInsets.all(15),
            // width: 120,
            // height: 50,
            decoration: new BoxDecoration(
              color: items[i]['select'].toString() == "0"
                  ? Colors.white
                  : Colours.bj_red_r2,
              borderRadius: new BorderRadius.all(new Radius.circular(5.0)),
            ),
            padding: new EdgeInsets.fromLTRB(0, 0, 0, 0),
            child: Padding(
                padding: new EdgeInsets.fromLTRB(15, 5, 15, 5),
                child: GestureDetector(
                    onTap: () {
                      FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
                      items[i]["select"] = '1';
                      for (var j = 0; j < items.length; j++) {
                        if (i == j) {
                          items[j]['select'] = '1';
                          setState(() {
                            chargemoney = items[j]['value'].toString();
                            total_num = items[j]['num'].toString();
                            pre_value = items[j]['pre_value'].toString();
                            groupid = items[i]['id'].toString();
                            selectlevel = items[i]['level_name'];
                          });
                        } else {
                          items[j]['select'] = '0';
                        }
                      }
                      setState(() {
                        moneylist = items;
                      });
                    },
                    child: new Container(
                      // height: 50,
                      decoration: new BoxDecoration(
                        // border: new Border.all(width: 2.0, color: Color.fromRGBO(27, 182, 251, 1)),

                        borderRadius:
                            new BorderRadius.all(new Radius.circular(1.0)),
                      ),
                      child: Column(
                        children: [
                          Text(
                            "¥${items[i]['money']}",
                            style: TextStyle(
                                fontWeight: FontWeight.w700,
                                fontSize: 15,
                                color: items[i]['select'].toString() == "0"
                                    ? Colors.black
                                    : Colors.white),
                          ),
                          // Text("额度${items[i]['num']}台",style: TextStyle(fontSize: 12,color: items[i]['select'].toString() == "0"?Colors.black:Colors.white),),
                          Text(
                            "认证检测 ${items[i]['auth_pre_price']}/台",
                            style: TextStyle(
                                fontSize: 12,
                                color: items[i]['select'].toString() == "0"
                                    ? Colours.text_gray
                                    : Colors.white),
                          ),
                          Text(
                            "历史里程 ${items[i]['query_milage_price']}/次",
                            style: TextStyle(
                                fontSize: 12,
                                color: items[i]['select'].toString() == "0"
                                    ? Colours.text_gray
                                    : Colors.white),
                          ),
                          Text(
                            "历史故障 ${items[i]['query_faultcode_price']}/次",
                            style: TextStyle(
                                fontSize: 12,
                                color: items[i]['select'].toString() == "0"
                                    ? Colours.text_gray
                                    : Colors.white),
                          ),
                          Text(
                            "质保返点 ${items[i]['ensurance_back_rate']}",
                            style: TextStyle(
                                fontSize: 12,
                                color: items[i]['select'].toString() == "0"
                                    ? Colours.text_gray
                                    : Colors.white),
                          ),
                          Text(
                            items[i]['self_inspect'].toString() == "1"
                                ? "自检系统 开通"
                                : "自检系统 未开通",
                            style: TextStyle(
                                fontSize: 12,
                                color: items[i]['select'].toString() == "0"
                                    ? Colours.text_gray
                                    : Colors.white),
                          ),
                        ],
                      ),
                      // child: Center(
                      //   child: Text(
                      //     "¥" +
                      //         items[i]['value'].toString() +
                      //         " 额度${items[i]['num']}台 ${items[i]['pre_value']}/台",
                      //     style: TextStyle(color: Colors.white),
                      //   ),
                      // ),
                      //  new Column(
                      //   children: <Widget>[
                      //     Center(
                      //       child: Text(items[i]['value']),
                      //     ),
                      //   ],
                    )))));
      }
    }
    // content = new Wrap(
    //     children: tiles //重点在这里，因为用编辑器写Column生成的children后面会跟一个<Widget>[]，
    //     //此时如果我们直接把生成的tiles放在<Widget>[]中是会报一个类型不匹配的错误，把<Widget>[]删了就可以了
    //     );
    content = new Wrap(
        children: tiles //重点在这里，因为用编辑器写Column生成的children后面会跟一个<Widget>[]，
        //此时如果我们直接把生成的tiles放在<Widget>[]中是会报一个类型不匹配的错误，把<Widget>[]删了就可以了
        );
    return content;
  }
}
